//
//  MineOrderNoramTableViewCell.m
//  shopping
//
//  Created by 马田成 on 2017/8/31.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "MineOrderNoramTableViewCell.h"
#import "MineOrderCollectionViewCell.h"
@implementation MineOrderNoramTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.sureBtn.layer.borderWidth = 1.0f;
    self.sureBtn.layer.borderColor = [UIColor redColor].CGColor;
    
    self.chaKanWLBtn.layer.borderWidth = 1.0f;
    self.chaKanWLBtn.layer.borderColor = [UIColor blackColor].CGColor;
    
    self.yanChangBtn.layer.borderWidth = 1.0f;
    self.yanChangBtn.layer.borderColor = [UIColor blackColor].CGColor;
    
    [self.collectionView layoutIfNeeded];
    //    self.automaticallyAdjustsScrollViewInsets = NO;
    self.collectionView.pagingEnabled = NO;
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    self.collectionView.scrollEnabled = NO;
    
    [self.collectionView registerNib:[UINib nibWithNibName:@"MineOrderCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"MineOrderCollectionViewCell"];
    
    self.collectionView.showsHorizontalScrollIndicator = NO;
    
    //    self.collectionView.bounces = NO;
    self.collectionView.backgroundColor = getColor(@"eeeeee");
    // Initialization code
}
//类别
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    
    return 1;
    
}
//数量
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    NSLog(@"LLLLLLLLLLLLLLLLLLLLLLLLL%lu", (unsigned long)self.arrOfPic.count);
//        numOfCount = self.arrOfPic.count;
    
    
//    return 2;
    
    return self.arrOfPic.count;
    
    
    
}
//内容

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    MineOrderCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MineOrderCollectionViewCell" forIndexPath:indexPath];
    NSMutableDictionary *dic  = self.arrOfPic[indexPath.row];
    if (self.arrOfPic) {
        
        NSString *urlWare=[dic objectForKey:@"goodsThums"];
        NSString *urlN=manage(AP_Img, urlWare);
    
        [cell.shopPic sd_setImageWithURL:[NSURL URLWithString:urlN] placeholderImage:[UIImage imageNamed:@""]];
        
        cell.goodsName.text = [dic objectForKey:@"goodsName"];
     
        cell.goodsAttrName.text = [dic objectForKey:@"goodsAttrName"];
        
        //    [cell.paymentButton addTarget:self action:@selector(paymentClick) forControlEvents:UIControlEventTouchUpInside];
        cell.yuanJia.text = [dic objectForKey:@"goodsPrice"];
        cell.youHuiJia.text = [dic objectForKey:@"goodsPrice"];
        
        //商品数量
        cell.numShop.text = [dic objectForKey:@"goodsNums"];;
    }
    return cell;
    
    
    
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(DEF_SCREEN_WIDTH, 91);
}
//确认收货
- (IBAction)sureClick:(UIButton *)sender {
    if (self.sureBlock) {
        self.sureBlock(sender);
        
    }
}

- (void)callBackOfSureSH:(sureShouHBlock)block{

    self.sureBlock = block;
    
    
}


//查看物流
- (IBAction)caKanWuLiuClick:(UIButton *)sender {
    if (self.chaKanBlock) {
        self.chaKanBlock(sender);
    }
    
}
- (void)callBackOfChaKan:(chaKanWLBlock)block{

    self.chaKanBlock = block;
    
}
//延长收货
- (IBAction)yanChangClick:(UIButton *)sender {
    if (self.yanChangBlock) {
        self.yanChangBlock(sender);
    }
    
}
- (void)callBackOfYanChang:(yanChangSH)block{

    self.yanChangBlock = block;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
